﻿﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Validation.aspx.cs" Inherits="Validation" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src="Scripts/IdCradValidation.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>

            <asp:Label ID="Label5" runat="server" Text="学号"></asp:Label>
            <asp:TextBox ID="TbNo" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TbNo" Display="Dynamic" ErrorMessage="学号不能为空" ValidationGroup="a"></asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TbNo" Display="Dynamic" ValidationExpression="\d{11}" ValidationGroup="a">学号必须为11位</asp:RegularExpressionValidator>
            <br />

            <asp:Label ID="Label1" runat="server" Text="用户名"></asp:Label>
            <asp:TextBox ID="TbUserName" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TbUserName" ErrorMessage="用户名必填" InitialValue="admin" ValidationGroup="a"></asp:RequiredFieldValidator>
            <br />
            <asp:Label ID="Label2" runat="server" Text="密码"></asp:Label>
            <asp:TextBox ID="TbPassword" runat="server" TextMode="Password"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TbPassword" ErrorMessage="密码不能为空" ValidationGroup="a"></asp:RequiredFieldValidator>
            <br />
            <asp:TextBox ID="TbPassword2" runat="server" TextMode="Password"></asp:TextBox>
            <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TbPassword" ControlToValidate="TbPassword2" ErrorMessage="确认密码不一致" ValidationGroup="a"></asp:CompareValidator>
            <br />
            <asp:Label ID="Label3" runat="server" Text="年龄"></asp:Label>
            <asp:TextBox ID="TbAge" runat="server"></asp:TextBox>
            <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TbAge" ErrorMessage="不正确年龄" MaximumValue="120" MinimumValue="0" Type="Integer" ValidationGroup="a"></asp:RangeValidator>
            <br />
            <asp:Label ID="Label4" runat="server" Text="电子邮件"></asp:Label>
            <asp:TextBox ID="TbEmail" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TbEmail" ErrorMessage="不正确的电子邮件地址" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="a"></asp:RegularExpressionValidator>
            <br />
            <asp:Label ID="Label6" runat="server" Text="身份证"></asp:Label>
            <asp:TextBox ID="TbIDCard" runat="server"></asp:TextBox>
            <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="CustomValidator1_ClientValidate" ControlToValidate="TbIDCard" ErrorMessage="非法身份证号" OnServerValidate="CustomValidator1_ServerValidate" ValidationGroup="a">身份证校验失败</asp:CustomValidator>
            <br />
            <asp:Button ID="BtnSubmit" runat="server" Text="提交" ValidationGroup="a" />
            <br />
            <br />
            <br />
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="a" ShowMessageBox="True" />
            <br />
            <br />
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox1" ErrorMessage="不能为空" ValidationGroup="b"></asp:RequiredFieldValidator>
            <br />
            <asp:Button ID="Button1" runat="server" Text="Button" ValidationGroup="b" />

        </div>
    </form>
</body>
</html>
